window._HQM = {

    _GAMEID:'5809',

    _USERNAME:null,

    _QHCHANNEL:null,

    _QHCHANNELID:null,

    _KEY:'e28656ea0d565e6ac5999654866c2698',

    _SERVERID:'1',

    _ACT:'1',

    _VIP:'0',

    getParamFromUrl:function(url,paramname){
        var urlarr = url.split(paramname+"=");
        if(urlarr.length>=2){
            urlarr=urlarr[1].split("&");
            return urlarr[0];
        }
        return null;
    },

    init:function(url){
        _HQM._USERNAME = _HQM.getParamFromUrl(url,'username');
        _HQM._QHCHANNEL = _HQM.getParamFromUrl(url,'qhchannel');
        _HQM._QHCHANNELID = _HQM.getParamFromUrl(url,'qhchannelid');
        
        window._CS.dataSavePre = window._CS.dataSaveSource+"-"+_HQM._USERNAME;

        var initdata = { 
            "username":_HQM._USERNAME,//用户id，群黑登录接口里面username参数
            "gid":_HQM._GAMEID,//群黑游戏id，可以在后台游戏列表查询
            "qhchannel":_HQM._QHCHANNEL,//用户标识，群黑登录接口里面qhchannel参数
            "qhchannelid":_HQM._QHCHANNELID,//用户标识id，群黑登录接口里面qhchannelid参数
            "time":new Date().getTime()//用户登录时间戳，群黑登录接口里面time参数
         };	

         console.log(initdata);

         qhsdk.init(initdata);
    },

    /*

    验证签名，md5(act_username_serverid_roleid_level_power_vip_key) 这里传递的md5字串为小写字母, 这里的key是提交到后台的登录key



    */
    uploadRole:function(player,sign){

        var roledata = {"act":"1",
        "username":_HQM._USERNAME,
        "serverid":_HQM._SERVERID,
        "rolename":player.name,
        "roleid":player.roleid,
        "level":player.lv,
        "power":player.power,
        "rolecreatetime":new Date().getTime(),
        "sign":sign};
        qhsdk.role(roledata);

    },




}